{extends file="asset:layout.tpl"}

{block CONTENT}
    {if isset($error_msg)}
        {$error_msg}
    {/if}
    <form action="{$REQUEST_URI}" method="post" accept-charset="UTF-8" class="form-horizontal" data-ajax-form="true" data-ajax-form-loading-text="{lang t="system|loading_please_wait"}">
        <div class="tabbable">
            <ul class="nav nav-tabs">
                <li class="active"><a href="#tab-1" data-toggle="tab">{lang t="system|general_statements"}</a></li>
                <li><a href="#tab-2" data-toggle="tab">{lang t="system|seo"}</a></li>
            </ul>
            <div class="tab-content">
                <div id="tab-1" class="tab-pane fade in active">
                    {include file="asset:system/datepicker.tpl" datepicker=$publication_period}
                    <div class="form-group">
                        <label for="title" class="col-sm-2 control-label">{lang t="gallery|title"}</label>

                        <div class="col-sm-10">
                            <input class="form-control" type="text" name="title" id="title" value="{$form.title}" maxlength="120" required>
                        </div>
                    </div>
                </div>
                <div id="tab-2" class="tab-pane fade">
                    {include file="asset:system/seo_fields.tpl" seo=$SEO_FORM_FIELDS}
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" name="submit" class="btn btn-primary">{lang t="system|submit"}</button>
                <a href="{uri args="acp/gallery"}" class="btn btn-default">{lang t="system|cancel"}</a>
                {$form_token}
            </div>
        </div>
    </form>
    <form action="{uri args="acp/gallery/pictures/delete/id_$gallery_id"}" method="post">
        <nav id="adm-list" class="navbar navbar-default" role="navigation">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex2-collapse">
                    <span class="sr-only">{lang t="system|toggle_navigation"}</span>
                    <span class="icon-bar"></span> <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <span class="navbar-brand">{lang t="gallery|pictures"}</span>
            </div>
            <div class="collapse navbar-collapse navbar-ex2-collapse">
                <div class="navbar-text pull-right">
                    {check_access mode="link" path="acp/gallery/pictures/create/id_`$gallery_id`" icon="32/image" width="32" height="32"}
                    {check_access mode="input" path="acp/gallery/pictures/delete" icon="32/cancel" lang="system|delete_marked"}
                </div>
            </div>
        </nav>
        {redirect_message}
        {if isset($pictures)}
            <table id="acp-table" class="table table-striped table-hover">
                <thead>
                <tr>
                    {if $can_delete === true}
                        <th style="width:3%"><input type="checkbox" id="mark-all" value="1" {mark name="entries"}></th>
                    {/if}
                    <th>{lang t="gallery|picture"}</th>
                    <th>{lang t="system|description"}</th>
                    {if $can_order === true}
                        <th>{lang t="system|order"}</th>
                    {/if}
                    <th style="width:5%">{lang t="system|id"}</th>
                </tr>
                </thead>
                <tbody>
                {foreach $pictures as $row}
                    <tr>
                        {if $can_delete === true}
                            <td><input type="checkbox" name="entries[]" value="{$row.id}"></td>
                        {/if}
                        <td>{if $can_edit_picture}
                            <a href="{uri args="acp/gallery/pictures/edit/id_`$row.id`"}" title="{lang t="gallery|edit_picture"}">
                                <img src="{uri args="gallery/index/image/id_`$row.id`/action_thumb"}" alt=""></a>{else}
                                <img src="{uri args="gallery/index/image/id_`$row.id`/action_thumb"}" alt="">{/if}</td>
                        <td>{$row.description}</td>
                        {if $can_order === true}
                            <td>
                                {if !$row.last}
                                    <a href="{uri args="acp/gallery/pictures/order/id_`$row.id`/action_down"}" title="{lang t="system|move_down"}" data-ajax-form="true" data-ajax-form-loading-text="{lang t="system|loading_please_wait"}">
                                        {icon path="16/down" width="16" height="16" alt={lang t="system|move_down"}}
                                    </a>
                                {/if}
                                {if !$row.first}
                                    <a href="{uri args="acp/gallery/pictures/order/id_`$row.id`/action_up"}" title="{lang t="system|move_up"}" data-ajax-form="true" data-ajax-form-loading-text="{lang t="system|loading_please_wait"}">
                                        {icon path="16/up" width="16" height="16" alt={lang t="system|move_up"}}
                                    </a>
                                {/if}
                                {if $row.first && $row.last}
                                    {icon path="16/editdelete" width="16" height="16" alt={lang t="system|move_impossible"} title={lang t="system|move_impossible"}}
                                {/if}
                            </td>
                        {/if}
                        <td>{$row.id}</td>
                    </tr>
                {/foreach}
                </tbody>
            </table>
            {if $can_delete === true}
                {include file="asset:system/mark.tpl"}
            {/if}
        {else}
            <div class="alert alert-warning text-center">
                <strong>{lang t="system|no_entries"}</strong>
            </div>
        {/if}
    </form>
{/block}

{javascripts}
    {include_js module="system" file="forms"}
{/javascripts}